package com.study.design.pattern.pattern.behavioral.observer.guava;

import com.google.common.eventbus.Subscribe;

/**
 * @Author: gongsl
 * @Date: 2025-03-24 20:46
 * @description: 订阅者-短信通知服务
 */
public class SmsNotifier {
    /**
     * 使用@Subscribe注解标记订阅方法
     * 方法参数必须与事件类型匹配
     */
    @Subscribe
    public void handleDeliveryUpdate(DeliveryStatusUpdateEvent event) {
        System.out.printf("[短信] 订单 %s 状态更新为：%s，已发送至 %s%n",
                event.getOrderId(), event.getNewStatus(), event.getCustomerPhone());
    }
}
